
package com.jf.cloud.multishop.controller.multishop;


import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.common.security.AuthUserContext;
import com.jf.cloud.multishop.dto.ShopWithdrawCashDTO;
import com.jf.cloud.multishop.service.ShopWithdrawCashService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import ma.glasnost.orika.MapperFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 商家提现申请信息
 *
 * @author zz
 * @date 2021-06-10 10:28:13
 */
@RestController("multishopShopWithdrawCashController")
@RequestMapping("/m/shop_withdraw_cash")
@Tag(name = "multishop-商家提现申请信息")
public class ShopWithdrawCashController {

    @Autowired
    private ShopWithdrawCashService shopWithdrawCashService;
    @Autowired
    private MapperFacade mapperFacade;

    @PostMapping("/apply")
    @Operation(summary = "商家提交申请提现" , description = "商家提交申请提现")
    public ServerResponseEntity<Void> apply(@RequestBody ShopWithdrawCashDTO shopWithdrawCashDTO) {
        shopWithdrawCashService.apply(shopWithdrawCashDTO, AuthUserContext.get().getTenantId());
        return ServerResponseEntity.success();
    }

    @GetMapping("/check_draw_cash_amount")
    @Operation(summary = "提现金额检查", description = "")
    public ServerResponseEntity<Boolean> checkDrawCashAmount(Long amount) {
        shopWithdrawCashService.checkDrawCashAmount(amount);
        return ServerResponseEntity.success(true);
    }
//    @GetMapping("/page")
//    @Operation(summary = "获取商家提现记录信息" , description = "获取商家提现记录信息")
//    public ServerResponseEntity<PageVO<ShopWithdrawCashVO>> page(PageDTO pageDTO, ShopWithdrawCashDTO shopWithdrawCashDTO) {
//        shopWithdrawCashDTO.setShopId(AuthUserContext.get().getTenantId());
//        PageVO<ShopWithdrawCashVO> pageVO = shopWithdrawCashService.pageByParam(pageDTO, shopWithdrawCashDTO);
//        return ServerResponseEntity.success(pageVO);
//    }

}
